{include file="common:lay_header" / }
{include file="common:upload" / }
<body>
<form class="layui-form" action="" lay-filter="example">
    <div class="layui-form-item">
        <label class="layui-form-label">标题</label>
        <div class="layui-input-block">
            <input type="text" name="name" lay-verify="required" value="{$info.name}" autocomplete="off" placeholder="请输入标题" class="layui-input">
        </div>
    </div>



    <div class="layui-form-item">
        <label class="layui-form-label">值</label>
        <div class="layui-input-block">
            <input type="text" name="value" lay-verify="required" value="{$info.value}" autocomplete="off" placeholder="请输入值" class="layui-input">
        </div>
    </div>


    <script type="text/javascript" src="/static/index/js/jquery-3.2.1.min.js"></script>
    <script type="text/javascript" src="/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" src="/ueditor/ueditor.all.min.js"></script>
    <script type="text/javascript" src="/ueditor/lang/zh-cn/zh-cn.js"></script>

    <div class="layui-form-item">
        <label class="layui-form-label">详情</label>
        <div class="layui-input-block">
            <textarea id="demo" style="display: block;" name="content">{$info.content}</textarea>
            <script type="text/javascript">
                UE.getEditor('demo',{initialFrameWidth:600,initialFrameHeight:300})
            </script>
        </div>
    </div>
    <input type="hidden" name="id" value="{$info.id}">
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
        </div>
    </div>
</form>


<script src="__LAYUI__/layui.js" charset="utf-8"></script>

<script>
    layui.use(['upload','form','layedit'], function(){
        var $ = layui.jquery
            ,upload = layui.upload
            ,form = layui.form
//            ,layedit = layui.layedit;

        // layedit.set({
        //     uploadImage: {
        //         url: '/admin/upload/layui_upload' //接口url
        //         ,type: 'post' //默认post
        //     }
        // });
        //普通图片上传
        one_upload(upload,$);
  //     var index =  layedit.build('demo'); //建立编辑器;
        //监听提交
        form.on('submit(demo1)', function(data){

            let json_field = data.field;
            //json_field.content = layedit.getContent(index);
            let url = "{:url('update')}";
            let params = json_field;
            console.log(params)
            _axios(url,params)
            return false;
        });
    });
</script>

</body>
</html>